package com.keffect;

import java.awt.Graphics2D;

import com.keffectpanel.KEffectPanel;

/**
 * Interface for a graphic effect that run in a <code>panel</code> of the class
 * {@link com.keffectpanel.KEffectPanel}.
 * <p>
 * 
 * This effect is associated with a <b>panel</b> of the class
 * {@link com.keffectpanel.KEffectPanel}. When the <b>panel</b> do the paint of
 * their components it invoke the operation {@link #doPaintBefore(Graphics2D)}
 * and {@link #doPaintAfter(Graphics2D)}. A class that implements this interface
 * should take into account the difference of implement each of them.
 * 
 * @author Matias Varela
 *         <p>
 *         Student of Licenciatura en Ciencias de la Computacion, at the
 *         Universidad Nacional del Sur (Argentina).
 *         <p>
 *         project site: http://code.google.com/p/keffect-project/
 * 
 */

public interface KEffect {

	/* <<< QUERIES >>> */

	/**
	 * Returns whether the graphic effect is currently running.
	 * 
	 * @return <code>true</code> if the graphic effect is running;
	 *         <code>false</code> otherwise.
	 */
	public boolean isActive();


	/**
	 * Returns the panel associated with this graphic effect.
	 * 
	 * @return the panel associated with this graphic effect.
	 */
	public KEffectPanel getEffectPanel();


	/* <<< COMMANDS >>> */

	/**
	 * Set the <code>KEffectPanel</code> Object where this graphic effect will
	 * be painted.
	 * 
	 * @param panel
	 *            the <code>KEffectPanel</code> Object where the graphic effect
	 *            will be painted.
	 */
	public void setEffectPanel(KEffectPanel panel);


	/**
	 * Start running the graphic effect.
	 */
	public void start();


	/**
	 * Initialize the properties of the graphic effect.
	 */
	public void initEffectProperties();


	/**
	 * Do a paint on the graphics <code>g</code>. This method will do the paint
	 * on <code>g</code> before the <code>KEffectPanel</code> associated with
	 * this effect paints their components.
	 * 
	 * @param g
	 *            graphics
	 */
	public void doPaintBefore(Graphics2D g);


	/**
	 * Do a paint on the graphics <code>g</code>. This method will do the paint
	 * on <code>g</code> after the <code>KEffectPanel</code> associated with
	 * this effect paints their components.
	 * 
	 * @param g
	 *            graphics
	 */
	public void doPaintAfter(Graphics2D g);


	/**
	 * Stop and remove the graphic effect.
	 */
	public void stop();
}
